home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / ClickExit.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  2.5 KB  |  72 lines

  1. public class ClickExit extends Codex {
  2.    private CodexThing exitThing = new CodexThing(((Codex)this).GetClassThing());
  3.    private int _exitNumber;
  4.    private String _locationName = "";
  5.    private String originalDescID = "";
  6.    private boolean bGotID;
  7.    public static String[] _params = new String[]{"Exit number;0"};
  8.  
  9.    public void clicked(int guid, int clickerGuid, int captureID) {
  10.       if (this.bGotID) {
  11.          if (!CodexSequence.IsExitClosed(this._locationName, this._exitNumber)) {
  12.             CodexSequence.TakeExit(this._exitNumber, clickerGuid);
  13.          } else {
  14.             new CodexSound("locked_large_02.WAV", 300.0F, 600.0F, 100, 0, 0, clickerGuid);
  15.             CodexConsole.PrintNLS(clickerGuid, 0, "GEN_DOORLOCKED");
  16.          }
  17.  
  18.       }
  19.    }
  20.  
  21.    public ClickExit(int exitNumber) {
  22.       this._exitNumber = exitNumber;
  23.    }
  24.  
  25.    public void beginscene(int clientGuid, int captureID) {
  26.       this.exitThing.SetThingFlags(2097152);
  27.       CodexThing playerThing = new CodexThing(clientGuid);
  28.       int locationNum = playerThing.GetLocationNum();
  29.       this._locationName = CodexSequence.GetLocationName(locationNum);
  30.       if (!this.bGotID) {
  31.          this.originalDescID = this.exitThing.GetDescriptionID();
  32.          this.bGotID = true;
  33.       }
  34.  
  35.       if (!CodexSequence.IsExitValid(this._locationName, this._exitNumber)) {
  36.          this.exitThing.SetThingFlags(64);
  37.       } else {
  38.          this.exitThing.ClearThingFlags(64);
  39.       }
  40.  
  41.       if (CodexSequence.IsExitClosed(this._locationName, this._exitNumber)) {
  42.          this.exitThing.SetDescriptionID(this.originalDescID + "_L");
  43.       } else {
  44.          this.exitThing.SetDescriptionID(this.originalDescID);
  45.       }
  46.  
  47.    }
  48.  
  49.    public void restore(int flags) {
  50.       this.bGotID = CodexSequence.RestoreBoolean();
  51.       this.originalDescID = CodexSequence.RestoreString();
  52.       this._locationName = CodexSequence.RestoreString();
  53.    }
  54.  
  55.    public void save(int flags) {
  56.       CodexSequence.SaveBoolean(this.bGotID);
  57.       CodexSequence.SaveString(this.originalDescID);
  58.       CodexSequence.SaveString(this._locationName);
  59.    }
  60.  
  61.    public void exitstatechanged() {
  62.       if (this.bGotID) {
  63.          if (CodexSequence.IsExitClosed(this._locationName, this._exitNumber)) {
  64.             this.exitThing.SetDescriptionID(this.originalDescID + "_L");
  65.          } else {
  66.             this.exitThing.SetDescriptionID(this.originalDescID);
  67.          }
  68.  
  69.       }
  70.    }
  71. }
  72.